package com.liuhan.house.controller;

import com.liuhan.house.common.ServerResponse;
import com.liuhan.house.pojo.Community;
import com.liuhan.house.service.CommunityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CommunityController {
    @Autowired
    private CommunityService communityService;

    @RequestMapping("community/getByCityName")
    @ResponseBody
    public ServerResponse getByCityName(@RequestParam("cityName") String cityName) {
        List<Community> communityList = communityService.getByCityName(cityName);
        return ServerResponse.createBySuccess("查询成功", communityList);

    }
}
